package com.baizhi.service;

import com.baizhi.dao.UserDao;
import com.baizhi.entrty.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    private Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
    @Autowired
    private UserDao userDao;

    @Override
    public Map fy(int page, int rows) {


        logger.error("1111111111111");
        logger.warn("22222222222222");
        logger.info("33333333333333");
        logger.debug("4444444444444");



        logger.info("分页开始");
        int count = userDao.getCount();
        int start = (page-1)*rows;

        Map map = new HashMap();
        List<User> list = userDao.getUser(start,rows);

        map.put("total",count);
        map.put("rows",list);
        logger.info("分页结束");
        return map;
    }

    @Override
    public void dj(int[] id) {
        logger.info("用户冻结开始");
        userDao.dj(id);
        logger.info("用户冻结结束");
    }

    @Override
    public void jd(int[] id) {
        logger.info("用户解冻开始");
        userDao.jd(id);
        logger.info("用户解冻结束");
    }

    @Override
    public User showUser(int userId) {
        return userDao.showUser(userId);
    }

    @Override
    public void update(int userId, String userImage, String userName) {
        userDao.update(userId,userImage,userName);
    }

    @Override
    public int getNan() {

        return userDao.getNan();
    }

    @Override
    public int getNv() {

        return userDao.getNv();
    }

    /*@Override
    public void getNv() {
        //Map map = new HashMap();
       int s =  userDao.getNv();
        //map.put("sex",maps);
        return s;
    }*/
}
